<?
include('../ajax/sysData.php');
include('../ajax/ajaxContactForm.php');
include('../appInit.php');

// Populate Language select menu
$langSelect = getLanguages();

// Populate Ethnicity select menu
$ethSelect = getEthnicities();

// Populate disability select menu
$disabilitySelect = getDisabilities();

// Populate Roles select menus
$roleParent       = getRoles('Parent','select',$_SESSION['org']);
$roleProfessional = getRoles('Professional','select',$_SESSION['org']);
$roleOther        = getRoles('Other','select',$_SESSION['org']);

$id       = $_POST[id];
$memberID = $_GET['memberID'];
if (empty($memberID)) {
	/*
	 * If we have just opened this tab, memberID should be 0
	 */
	$memberID = 0;
} else {
	$memberJSON  = getMemberInformation($memberID,$id,0,0,0);
	$memberArray = Zend_Json::decode($memberJSON);
	
	$nameFirst = $memberArray['FirstName'];
	$nameLast  = $memberArray['LastName'];
}
?>
		<input type="hidden" name="memberID<?=$id; ?>" id="memberID<?=$id; ?>" value="<?=$memberID; ?>" />
		<div id="tabHTMLDiv">
			<div class="tab-content">
				<div style="float: left; width: 150px;">
					<label class="vertLabelSmall">First Name</label>
					<input tabindex="8" type="text" style="width: 138px;" onBlur="contactFormSupportObj.updateTabTitle(<?=$id; ?>);" id="nameFirst<?=$id; ?>" /><br />
					<label class="vertLabelSmall">Zip Code</label>
					<input tabindex="10" type="text" id="zipCode<?=$id; ?>" style="width: 138px;" />
				</div>
				<div style="float: left; width: 150px;">
					<label class="vertLabelSmall">Last Name</label>
					<input tabindex="12" type="text" style="width: 138px;" onBlur="contactFormSupportObj.updateTabTitle(<?=$id; ?>);" id="nameLast<?=$id; ?>" />
					<div id="nameLastAutocompleter<?=$id; ?>" name="nameLastAutocompleterField<?=$id; ?>" class="autocomplete"></div>
					<div style="height: 20px;"></div>
					<input tabindex="11" type="radio" name="memberGenderRadio" id="memberGenderMale<?=$id; ?>" /> <span class="labelSmall">Male</span>
					<input tabindex="12" type="radio" name="memberGenderRadio" id="memberGenderFemale<?=$id; ?>" /> <span class="labelSmall">Female</span>
					
				</div>
				<div style="float: left; width: 140px;">
					<label class="vertLabelSmall">Member Type</label>
					<input style="margin: 2px;" class="checkboxMemberType<?=$id; ?>" type="checkbox" id="memberTypeChild<?=$id; ?>"  value="Child" onClick="contactFormSupportObj.showMemberTypePanel('Child',<?=$id; ?>);" /> <span>Child</span><br />
					<input style="margin: 2px;" class="checkboxMemberType<?=$id; ?>" type="checkbox" id="memberTypeParent<?=$id; ?>" value="Parent" onClick="contactFormSupportObj.showMemberTypePanel('Parent',<?=$id; ?>);" /> <span>Parent</span><br /> 
					<input style="margin: 2px;" class="checkboxMemberType<?=$id; ?>" type="checkbox" id="memberTypeProfessional<?=$id; ?>" value="Professional" onClick="contactFormSupportObj.showMemberTypePanel('Professional',<?=$id; ?>);" /> <span>Professional</span><br />
					<input style="margin: 2px;" class="checkboxMemberType<?=$id; ?>" type="checkbox" id="memberTypeOther<?=$id; ?>" value="Other" onClick="contactFormSupportObj.showMemberTypePanel('Other',<?=$id; ?>);" /> <span>Other Family Member</span><br /> 
				</div>
				<div style="float: left;" id="memberTypeOptionsContainer<?=$id; ?>">
					<!-- MemberTypeOptions -->
					<div id="memberTypeOptionPanels<?=$id; ?>">
						<!-- Member Type Child -->
						<div class="memberType<?=$id; ?>" id="panelChild<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Childs' Age or Date of Birth</label>					
						
							<div style="float: left;">
								<select id="childAgeYr<?=$id; ?>" style="width: 50px;" size="1">
								<option>Yr...</option>
								<?
								for($a=1;$a<=18;$a++) {
									echo '<option value="'.$a.'">'.$a.'</option>';
								}
								?>
								</select>	
								<select id="childAgeMonth<?=$id; ?>" style="width: 50px;" size="1">
								<option>Mo...</option>
								<?
								for($a=1;$a<=11;$a++) {
									echo '<option value="'.$a.'">'.$a.'</option>';
								}
								?>
								</select>															
						</div>
						<div style="float: left; margin-right: 5px; margin-left: 5px;">
							<input type="text" style="width: 100px;" id="dateFieldBirth<?=$id; ?>" value="<?=date('m/d/Y'); ?>" />
							</div>
							<div style="clear: left;"></div>
						</div>
						
						<!-- Member Type Parent -->
						<div class="memberType<?=$id; ?>" id="panelParent<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Parent Role</label>
							
							<select id="parentRole<?=$id; ?>" size="1" class="selectRole<?=$id; ?>" style="width: 140px;">
							<?=$roleParent; ?>
							</select>
							<div style="margin-top: 5px;"><input type="checkbox" id="parentSingle<?=$id; ?>" value="1" /> <span>Single Parent</span></div>							
						</div>
						
						<!-- Member Type Professional -->
						<div class="memberType<?=$id; ?>" id="panelProfessional<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Professional Role</label>
							
							<select id="professionalRole<?=$id; ?>" class="selectRole<?=$id; ?>" size="1" style="width: 216px;">
							<?=$roleProfessional; ?>
							</select><br />
							<label class="vertLabelSmall">Organization</label>
							<input type="text" id="professionalOrg<?=$id; ?>" style="width: 210px;" /><br />
							<label class="vertLabelSmall">Title</label>
							<input type="text" id="professionalTitle<?=$id; ?>" style="width: 210px;" /><br />	
							<label class="vertLabelSmall">Website URL</label>
							<input type="text" id="professionalURL<?=$id; ?>" style="width: 210px;" value="http://" />							
						</div>
						
						<!-- Member Type Other Family Member -->
						<div class="memberType<?=$id; ?>" id="panelOther<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Other Role</label>
							
							<select id="otherRole<?=$id; ?>" class="selectRole<?=$id; ?>" size="1" style="width: 140px;">
							<?=$roleOther; ?>
							</select>
						</div>
					</div>	
					<!-- End MemberTypeOptions -->
				</div>
			<div style="clear: left;"></div>
			<div style="height: 10px;"></div>
		
			<div style="float: left; width: 300px;">
				<label class="vertLabelSmall">Address</label>
				<input tabindex="13" type="text" id="address<?=$id; ?>" style="width: 290px;" />
			</div>				
			<div style="float: left; width: 155px;">
				<label class="vertLabelSmall">Home Phone</label>
				<input tabindex="26" type="text" id="phone1<?=$id; ?>" style="width: 145px;" />
				<div id="phone1Autocompleter<?=$id; ?>" name="phone1AutocompleterField<?=$id; ?>" class="autocomplete"></div>
			</div>
			<div style="float: left; width: 145px;">
				<label class="vertLabelSmall">Cell Phone</label>
				<input tabindex="20" type="text" id="phone2<?=$id; ?>" style="width: 145px;" />
			</div>
			<div style="clear: left;"></div>
		
			<div style="float: left; width: 300px;">
				<label class="vertLabelSmall">City</label>
				<input tabindex="14" type="text" id="city<?=$id; ?>" style="width: 290px;" />
			</div>				
			<div style="float: left; width: 155px;">
				<label class="vertLabelSmall">Work Phone</label>
				<input tabindex="19" type="text" id="phone3<?=$id; ?>" style="width: 145px;" />
			</div>
			<div style="float: left; width: 145px;">
				<label class="vertLabelSmall">Fax</label>
				<input tabindex="20" type="text" id="phone4<?=$id; ?>" style="width: 145px;" />
			</div>		
			<div style="clear: left;"></div>
		
			<div style="float: left; width: 150px;">
				<label class="vertLabelSmall">State</label>
				<select tabindex="15" id="state<?=$id; ?>" size="1" style="width: 140px;">
				<? include('includes/states.html'); ?>
				</select> 
			</div>			
			<div style="float: left; width: 150px;">
				<label class="vertLabelSmall">County</label>
				<select tabindex="16" id="selectCounty<?=$id; ?>" size="1" style="width: 140px;">
				<option>Select...</option>
				<option></option>
				<? include('includes/countiesOregon.html'); ?>
				</select> 
			</div>
			<div style="float: left; width: 155px;">
				<label class="vertLabelSmall">Email (Primary)</label>
				<input tabindex="19" type="text" id="email1<?=$id; ?>" style="width: 145px;" />
			</div>
			<div style="float: left; width: 145px;">
				<label class="vertLabelSmall">Email (Secondary)</label>
				<input tabindex="20" type="text" id="email2<?=$id; ?>" style="width: 145px;" />
			</div>		
			<div style="clear: left;"></div>				
		
			<div style="float: left; width: 300px;">
				<label class="vertLabelSmall">Disability</label>
				<select tabindex="30" style="width: 290px;" size="1" id="selectDisability<?=$id; ?>" name="selectDisability<?=$id; ?>">
				<option>Select...</option>
				<option></option>
				<?=$disabilitySelect; ?>
				</select>
			</div>		
			<div style="float: left; width: 155px;">
				<label class="vertLabelSmall">Primary Language</label>
				<select tabindex="22" id="selectLanguage<?=$id; ?>" size="1" style="width: 145px;">
				<option>Select...</option>
				<option></option>
				<?=$langSelect; ?>
				</select> 
			</div>	
			<div style="float: left; width: 145px;">
				<label class="vertLabelSmall">Ethnicity</label>
				<select tabindex="22" id="selectEthnicity<?=$id; ?>" size="1" style="width: 145px;">
				<option>Select...</option>
				<option></option>
				<?=$ethSelect; ?>
				</select> 
			</div>
			<div style="clear: left; height: 15px;"></div>		
			
			<div style="float: left; width: 300px;">
				<label class="vertLabelSmall">Name of School</label>
				<input tabindex="17" type="text" id="nameOfSchool<?=$id; ?>" style="width: 290px;" />
			</div>		
			<div style="float: left; width: 350px;">
				<label style="margin-bottom: 7px;" class="vertLabelSmall">Type of School</label>
				<input tabindex="25" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypePublic<?=$id; ?>" value="Public" checked /> <span>Public</span>
				<input tabindex="26" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypePrivate<?=$id; ?>" value="Private" /> <span>Private</span>
				<input tabindex="27" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypeHome<?=$id; ?>" value="Home" /> <span>Home School</span>
				<input tabindex="28" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypeCharter<?=$id; ?>" value="Charter" /> <span>Charter</span>		
				<input tabindex="35" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypeNone<?=$id; ?>" value="" checked /> <span>None / NA</span>			
			</div>
			<div style="clear: left;"></div>
			
			<div style="float: left; width: 320px;">
				<label style="margin-bottom: 7px;" class="vertLabelSmall">School District</label>
				<input type="text" style="width: 275px;" tabindex="25" id="selectSchoolDistrict<?=$id; ?>" name="selectSchoolDistrict<?=$id; ?>" />
			</div>	
			
			<div style="float: left; width: 300px;">
				<div style="margin-top: 25px;">
					<input type="checkbox" id="familyLowLiteracy<?=$id; ?>" value="1" /> <span class="labelSmall">Low Literacy</span>
					<input type="checkbox" id="familyLowIncome<?=$id; ?>" value="1" /> <span class="labelSmall">Low Income</span>        	
	    		</div>
			</div>	
			<div style="clear: left;"></div>		
		
			<div class="emphBox" id="metaInfo" style="font-size: 1em; width: 100%;">
				<div class="emphBoxInner">
					<div style="vertical-align: top; float: left; width: 200px;">
					Ok to contact by:
					</div>
					<div style="vertical-align: top; float: left;">
						<input type="checkbox" value="1" id="okToContactPhoneHome<?=$id; ?>" /> Home Phone
						<input type="checkbox" value="1" id="okToContactPhoneWork<?=$id; ?>" /> Work Phone
						<input type="checkbox" value="1" id="okToContactEmail<?=$id; ?>" /> Email
					</div>
					<div style="clear: left;"></div>
				</div>
			</div>	
		
			<div style="float: left; margin-top: 10px;">
			<div style="float: left; margin-right: 5px;">
				<a href="#" class="coolButton buttonBGBlueGray" tabindex="37" onClick="contactSaveFamilyTeamObj.saveTeamMember(<?=$id; ?>); return false;"><span class="update">Save</span></a>
			</div>
			<div style="float: left; display: none;" id="buttonDeleteMember<?=$id; ?>">
				<a href="#" class="coolButton buttonBGRed" tabindex="38" onClick="confirmDelete(<?=$id; ?>,'member'); return false;" title="Delete this members' information"><span class="cancel">Delete</span></a>
			</div>
			<div style="clear: left;"></div>
			</div>	
			<div style="float: right; margin-top: 10px;">
				<div id="messageMember<?=$id; ?>"></div>
			</div>
			<div style="clear: both;"></div>
			</div>
		</div>
<script type="text/javascript">
	contactFormSupportObj.addMemberTabElements(<?=$id; ?>);
	// Set activeMemberID
	contactFormSupportObj.setActiveMemberID(<?=$memberID; ?>);
	<? if (!empty($memberJSON)) { ?>
	contactFormGetInfoObj.returnGetMemberInformation(<?=$memberJSON; ?>,<?=$id; ?>);
	<? } ?>	
</script>